package LeetcodeTest_eight;
//剑指 Offer 53 - II. 0～n-1中缺失的数字
public class missingNumber
{
    public static void main(String[] args)
    {
        int num[]={0};
        System.out.println(Solution.missingNumber(num));
    }
}
class Solution
{
    public static int missingNumber(int[] nums)
    {
        int sum1=0;
        int sum2=0;
        if(nums.length==1&&nums[0]==0)
            return 1;
        for(int i=1;i<=nums.length;i++)
            sum1+=i;
        for(int i=0;i<nums.length;i++)
            sum2+=nums[i];
        return sum1-sum2;
    }
}